# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=ruby-os
_gemname=${pkgname#ruby-}
pkgver=1.1.4
pkgrel=1
pkgdesc='Provide basic information about the operating system.'
arch=('any')
url='https://github.com/rdp/os'
license=('MIT')
depends=('ruby')
source=("https://rubygems.org/downloads/$_gemname-$pkgver.gem")
noextract=("$_gemname-$pkgver.gem")
sha512sums=('988eccce8c32aafecdaeec6eb09e079699a2da886e5763541e93f3374d82963cc6582eb905e353008e3ac8a2994eff0e7f9e6bf8005dc10eeb7956cfd949dd48')

package() {
  _gemdir="$(ruby -e'puts Gem.default_dir')"

  gem install --ignore-dependencies --no-user-install --no-document \
    -i "$pkgdir/$_gemdir" -n "$pkgdir/usr/bin" "$_gemname-$pkgver.gem"

  rm "$pkgdir/$_gemdir/cache/$_gemname-$pkgver.gem"

  find "$pkgdir/$_gemdir/extensions/" -name *.so -delete

  install -Dm 644 "$pkgdir/$_gemdir/gems/$_gemname-$pkgver/LICENSE" \
    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

